<% total_geral = 0%>
<% @depositos.each do |d| %>
  <% pares_por_deposito = 0%>
  <div class='deposito_<%= d.nome.downcase_br %>'>
    <div class='title_<%= d.nome.downcase_br %>' style="background-color:<%=d.cor%>;font-size:18px;
      font: normal bold Arial, Helvetica, sans-serif;
      text-align:center;">
      <%=h d.nome.upcase_br %>
    </div>
    <table cellpadding="1" cellspacing="0">

      <th><strong>DEPOSITO</strong></th>
      <th><strong>BOX</strong></th>
      <th><strong>Nº.DT</strong></th>
      <th><strong>TRANSP.</strong></th>
      <th><strong>UF</strong></th>
      <th><strong>PARES</strong></th>
      <th><strong>CXS</strong></th>
      <th><strong>TIPO</strong></th>
      <th><strong>VOLUME</strong></th>
      <th><strong>PESO</strong></th>
      <th><strong>STATUS</strong></th>
      <th><strong>HORA</strong></th>
      <th><strong>ETQ</strong></th>
      <th><strong>OBS</strong></th>

      <% d.transportes.each do |wm| %>
        <tr class="<%= cycle("even", "odd") -%>">
          <%  armazenamento = Armazenamento.deposito_transporte(d.id,wm.id)[0]%>
          <td><%=d.nome%></td>
          <td><%=armazenamento.box%></td>
          <td><%=wm.ndt.para_dinheiro.to_s_m%></td>
          <td><%=wm.transportadora.nome%></td>
          <td><%=wm.destino.sigla%></td>
          <td><%=armazenamento.pares.para_dinheiro.to_s_m%></td>
          <% pares_por_deposito += armazenamento.pares%>
          <td><%=armazenamento.cxs.para_dinheiro.to_s_m%></td>
          <td><%=wm.tipo.sigla%></td>
          <td><%=wm.m.para_dinheiro.to_s_m%></td>
          <td><%=wm.peso.para_dinheiro.to_s_m%></td>
          <td><%=wm.status.sigla%></td>
          <td><%=wm.created_at.hour.to_s + ":" + wm.created_at.min.to_s + ":" + wm.created_at.sec.to_s%></td>
          <td><%=wm.etiqueta%></td>
          <td><%=wm.obs_trans%></td>
        </tr>
      <%end%>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td  class="soma_pares_depositos"><%= pares_por_deposito.para_dinheiro.to_s_m%></td>
        <% total_geral += pares_por_deposito%>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </table>
  <%end%>
  <div id='soma_total_deposito'>
    <label class='total'>Total:</label>
    <label class='valor'><%= total_geral.to_i.para_dinheiro.to_s_m %></label>
  </div>
</div>